<template>
  <li class="recommend-item">
    <a href="javascript:;">
      <img
        src="https://cdn.cnbj1.fds.api.mi-img.com/nr-pub/202207011841_084ed41d67f248677914605b73faf582.png?thumb=1&w=225&h=225&f=webp&q=90"
        alt="" />
      <div class="recommend-name">Xiaomi 12 Pro 天玑版</div>
      <div class="recommend-price">3999元</div>
      <div class="recommend-tips">9695人好评</div>
    </a>
    <div class="recommend-action">
      <a
        href="javascript:;"
        class="btn">
        加入购物车
      </a>
    </div>
    <div class="recommend-notice">
      <a
        href="javascript:;"
        class="btn">
        成功加入购物车
      </a>
    </div>
  </li>
</template>

<script setup lang="ts"></script>

<style lang="less" scoped>
.recommend-item {
  float: left;
  width: 234px;
  height: 300px;
  padding: 0 20px;
  margin: 0 0 14px 14px;
  padding: 0;
  position: relative;
  overflow: hidden;
  list-style: none;
  background-color: #fff;
  text-align: center;
  a {
    img {
      display: block;
      margin: 40px auto 20px;
      width: 140px;
      height: 140px;
    }
    .recommend-name {
      margin: 0 10px 10px;
      height: 18px;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
      color: #333;
    }
    .recommend-price {
      margin-bottom: 10px;
      color: #ff6700;
    }
    .recommend-tips {
      position: relative;
      color: #757575;
    }
  }
  &:hover .recommend-action {
    bottom: 72px;
  }
  .recommend-action {
    position: absolute;
    left: 0;
    bottom: 16px;
    width: 100%;
    opacity: 1;
    transform: translate3d(0, 200%, 0);
    transition: all 0.4s;
    a {
      background: #fff;
      color: #ff6700;
      height: 28px;
      font-size: 12px;
      line-height: 28px;
      display: inline-block;
      width: 118px;
      border: 1px solid #ff6700;
      &:hover {
        color: #fff;
        background: #ff6700;
      }
    }
  }
  .recommend-notice {
    position: absolute;
    top: 0px;
    left: 0;
    z-index: 5;
    width: 100%;
    opacity: 0;
    transform: translate3d(0, -10px, 0);
    transition: all 0.2s linear;
    a {
      line-height: 38px;
      background: #83c44e;
      border-color: #83c44e;
      color: #fff;
      display: block;
      width: 100%;
      height: 38px;
    }
  }
}
</style>
